﻿#pragma once
#include"common.h"
class Centralcache
{
public:
	static Centralcache* GetInstance()
	{
		return &_sInst;
	}
	// 获取⼀个⾮空的span
	Span* GetOneSpan(SpanList& list, size_t byte_size);
	// 从中⼼缓存获取⼀定数量的对象给thread cache
	size_t FetchRangeObj(void*& start, void*& end, size_t batchNum, size_t size);
	// 将⼀定数量的对象释放到span跨度
	void ReleaseListToSpans(void* start, size_t byte_size);
private:
	SpanList _spanlists[MAX_LIST_NUM];
	Centralcache() {}
	Centralcache(const Centralcache&) = delete;
	static  Centralcache _sInst;
};